package site.mingdao.boot.web.plugin.log.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import site.mingdao.boot.web.plugin.log.core.interceptor.AccessLogInterceptor;

/**
 * 日志
 */
@EnableConfigurationProperties(LogProperties.class)
@ConditionalOnProperty(value = "mingdao.framework.access-log-enable")
public class LogAutoConfiguration implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AccessLogInterceptor());
    }

}